<cfsilent>
	<cftry>
		<!---<cfquery name="rs" datasource="#request.dsn#">
			-- doesn't contain is_identity
			SELECT *
			FROM INFORMATION_SCHEMA.COLUMNS
		</cfquery>--->
		<cfquery name="rs" datasource="#request.dsn#">
			SELECT 
				tab.name   Table_Name,
				col.name   Column_Name,
				col.colid  Column_Id,
				typ.name   Data_Type,
				col.length Length,
				col.prec   [Precision],
				col.scale  Scale,
				com.text   Default_Value,
			-- 	obj.name   Default_Cons_Name,
				CASE
					WHEN col.isnullable = 1 THEN 'Y'
					ELSE 'N'
				END		is_nullable,
				CASE
					WHEN col.status & 0x80 = 0x80 THEN 'Y'
					ELSE 'N'
				END		is_identity,
				CASE 
					WHEN pri.CONSTRAINT_NAME IS NULL THEN 'N'
					ELSE 'Y'
				END		Primary_Key
			FROM 
				sysobjects tab
				LEFT JOIN syscolumns col ON tab.id = col.id
				LEFT JOIN syscomments com ON col.cdefault = com.id 
					AND com.colid = 1
				LEFT JOIN sysobjects obj ON com.id = obj.id 
				LEFT JOIN systypes typ ON col.xusertype = typ.xusertype
				LEFT JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE pri ON pri.TABLE_NAME = tab.name
					AND pri.COLUMN_NAME = col.name
			WHERE 
				1=1
				AND tab.xtype = 'U'
				AND tab.name <> 'dtproperties'
			<cfif isDefined("attributes.table_name") and attributes.table_name neq "">
				AND tab.name IN (<cfqueryparam cfsqltype="cf_sql_varchar" list="yes" value="#attributes.table_name#" />)
			</cfif>
			ORDER BY 
				1, 3
			<!--- SELECT 
				tab.name   Table_Name,
				col.name   Column_Name,
				col.colid  Column_Id,
				typ.name   Data_Type,
				col.length Length,
				col.prec   [Precision],
				col.scale  Scale,
				com.text   Default_Value,
				obj.name   Default_Cons_Name,
				CASE
					WHEN col.isnullable = 1 THEN 'Y'
					ELSE 'N'
				END        is_nullable,
				CASE
					WHEN col.status & 0x80 = 0x80 THEN 'Y'
					ELSE 'N'
				END        is_identity
			FROM 
				sysobjects tab,
				syscolumns col LEFT OUTER JOIN
				syscomments com INNER JOIN
				sysobjects obj ON com.id = obj.id ON col.cdefault = com.id AND com.colid = 1,
				systypes typ
			WHERE 
				tab.id = col.id
				AND tab.xtype = 'U'
				AND tab.name <> 'dtproperties'
				AND col.xusertype = typ.xusertype
			<cfif isDefined("attributes.table_name") and attributes.table_name neq "">
				AND tab.name IN (<cfqueryparam cfsqltype="cf_sql_varchar" list="yes" value="#attributes.table_name#" />)
			</cfif>
			ORDER BY 
				1, 3 --->
		</cfquery>
		<cfcatch>
		</cfcatch>
	</cftry>
</cfsilent>